package com.mcx.modules.data.localdata.create;

import com.mcx.modules.data.GameDataTableParser;
import com.mcx.modules.data.base.AbstractDBModel;

/** NPC数据管理 */
public class NPCDBModel extends AbstractDBModel<NPCDBModel, NPCEntity>
{
    private static NPCDBModel instance;

    public static NPCDBModel getInstance() {
        if (instance == null) {
            instance = new NPCDBModel();
        }
        return instance;
    }

    /** 文件名称 */
    @Override
    protected String FileName() {
        return "NPC.data";
    }

    /** 创建实体 */
    @Override
    protected NPCEntity MakeEntity(GameDataTableParser parse)
    {
        NPCEntity entity = new NPCEntity();
        entity.Id = parse.GetFieldValueToInt("Id");
        entity.Name = parse.GetFieldValueToUTF8String("Name");
        entity.PrefabName = parse.GetFieldValueToUTF8String("PrefabName");
        entity.HeadPic = parse.GetFieldValueToUTF8String("HeadPic");
        entity.HalfBodyPic = parse.GetFieldValueToUTF8String("HalfBodyPic");
        entity.Talk = parse.GetFieldValueToUTF8String("Talk");
        return entity;
    }
}
